/* eslint-disable no-return-await */
// post,patchJson, del, putJson, getData
import {get, getBuffer, postJson, postFile, del, post} from "./http.js";
let api = process.env.VUE_APP_API;
if (process.env.VUE_APP_Mock === "true") {
  api = "/mock/";
}
/**
 * 按需引入
 */
// 1.获取验证码 /api/platform/getKaptchaImage
export const loginKaptchaImage = async (p) => await getBuffer(`${api}/platform/getKaptchaImage`, p);
// 2.获取PublicKey
export const loginPublicKey = async (p) => await get(`${api}/platform/commonlogin/getPublicKey`, p);
// 3.登录
export const loginToLogin = async (p) => await postJson(`${api}/platform/commonlogin/toLogin`, p);
// 退出
export const toLogout = async (p) => await get(`${api}/platform/commonlogin/loginOut`, p);
// 7.获取系统、菜单
export const loginIndexData = async (p) => await get(`${api}/system/privilege/init`, p);
// 8.系统名称配置信息
export const systemPrivilegeInfo = async (p) => await get(`${api}/system/privilege/info`, p);
// 初始化接口
export const moduleInit = async (p) => await get(`${api}/witness/module/init`, p); // 匹配列表 - 列表
// 见证审核记录列表
export const approveList = async (p) => await postJson(`${api}/witness/record/approve/list`, p);
// 见证任务查看列表/gdw/gz/witness/record/view/list
export const viewList = async (p) => await postJson(`${api}/witness/record/view/list`, p);
// 见证任务-查看项目详情
export const projectDetail = async (p) => await get(`${api}/witness/project/detail`, p);
// 见证任务管理-获取见证系统code和name
export const defaultystemCode = async (p) => await get(`${api}/witness/system/default-systemCode`, p);
// 见证任务管理-手动新增见证任务
export const taskCreate = async (p) => await postJson(`${api}/witness/task/create`, p);
// 同步项目
export const pullProjectDetailCD = async (p) => await postJson(`${api}/witness/cd/projectInfoSync`, p);
// 查询标室数组
export const getAddressList = async (p) => await postJson(`${api}/witness/cd/queryFreeRoomByDay`, p);
// 选定标室
export const submitBookConfirm = async (p) => await postJson(`${api}/witness/cd/submitBookConfirm`, p);
// 查询见证任务列表(管理员使用)
// /gdw/witness/task/list
export const taskList = async (p) => await postJson(`${api}/witness/task/list`, p);
// 查询见证子任务列表(见证管理员使用)
// /gdw/witness/subtask/list/all
export const subtaskListAll = async (p) => await postJson(`${api}/witness/subtask/list/all`, p);
// 查看见证任务详情
// /gdw/witness/task/detail
export const taskDetail = async (p) => await get(`${api}/witness/task/detail`, p);
// 查询见证子任务列表(见证人员使用)
// /gdw/witness/subtask/list
export const subtaskList = async (p) => await postJson(`${api}/witness/subtask/list`, p);
// 我的见证(见证中、待见证、已完成)-列表
// /gdw/witness/myWitnessList
export const myWitnessList = async (p) => await postJson(`${api}/witness/myWitnessList`, p);
// 批量开启见证任务(见证人员使用)
// /gdw/witness/subtask/batch/start
export const subtaskBatchStart = async (p) => await postJson(`${api}/witness/subtask/batch/start`, p);
// 查询见证子任务列表(见证人员使用)
// /gdw/witness//subtask/list/part
export const subtaskListPart = async (p) => await postJson(`${api}/witness/subtask/list/part`, p);
// 查询见证子任务列表(管理员员使用)
// /gdw/witness/subtask/info
export const subtaskInfo = async (p) => await postJson(`${api}/witness/subtask/info`, p);
// 见证人正在见证的项目列表
// /gdw/witness/platform/project/list
export const platformProjectList = async (p) => await get(`${api}/witness/platform/project/list`, p);
// 任务分配 根据见证子任务id分配给见证用户（定向分配）移交任务
// /gdw/witness/subtask/allocate/user
export const subtaskAllocateUser = async (p) => await postJson(`${api}/witness/subtask/allocate/user`, p);
// 任务随机分配
// /gdw/witness/subtask/allocate/user/random
export const subtaskAllocateUserRandom = async (p) => await postJson(`${api}/witness/subtask/allocate/user/random`, p);
// 管理员 批量审核 见证任务
// /gdw/witness/subtask/batch/review
export const subtaskBatchReview = async (p) => await postJson(`${api}/witness/subtask/batch/review`, p);
// 查看见证子任务详情
// /gdw/witness/subtask/detail
export const subtaskDetail = async (p) => await get(api + "/witness/subtask/detail", p);
// 开启见证任务
// /gdw/witness/subtask/start  /gdw/gz/witness/subtask/start
export const subtaskStart = async (p) => await postJson(api + "/witness/subtask/start", p);
// 结束见证任务
// /gdw/witness/subtask/finish
export const subtaskFinish = async (p) => await get(`${api}/witness/subtask/finish`, p);
// 取消见证任务
// /gdw/witness/task/cancel
export const taskCancel = async (p) => await get(`${api}/witness/task/cancel`, p);
// 根据见证子任务id查询有权限的用户信息（定向分配）
// /gdw/witness/subtask/permission/user
export const subtaskPermissionUser = async (p) => await postJson(`${api}/witness/subtask/permission/user`, p);
// 管理员审核见证任务
// /gdw/witness/subtask/review
export const subtaskReview = async (p) => await postJson(`${api}/witness/subtask/review`, p);
// 见证记录 郑可开发
// 查询审核见证记录
// https://localhost:18089/gdw/record/sub/details
export const recordSubDetails = async (p) => await get(`${api}/record/sub/details`, p);
// 见证记录添加
// https://ip:port/gdw/witness/record/add
export const witnessRecordAdd = async (p) => await postJson(`${api}/witness/record/add`, p);
// 见证记录删除
// https://localhost:18089/gdw/witness/record/delete
export const witnessRecordDelete = async (p) => await postJson(`${api}/witness/record/delete`, p);
// 见证记录查询
// https://localhost:18089/gdw/witness/record/list
export const witnessRecordLists = async (p) => await get(`${api}/witness/record/list`, p);
// 见证记录查询
// https://localhost:18089/gdw/witness/record/list
export const witnessRecordList = async (p) => await get(`${api}/witness/record/list/workbench`, p);
// 见证人批量确认系统见证记录
// http://localhost:18089/gdw/witness/record/clicks
export const witnessRecordClicks = async (p) => await postJson(`${api}/witness/record/clicks`, p);
// 见证事项确认
// http://localhost:18089/gdw/witness/record/confirmOne
export const witnessRecordConfirmOne = async (p) => await postJson(`${api}/witness/record/confirmOne`, p);
// 修改见证记录
// http://localhost:18089/gdw/witness/record/update
export const witnessRecordUpdate = async (p) => await postJson(`${api}/witness/record/update`, p);
// 查看见证记录
// http://localhost:18089/gdw/witness/record/update
export const ToViiewRecord = async (p) => await postJson(`${api}/witness/subtask/detail`, p);
// 审核通过
export const Approved = async (p) => await postJson(`${api}/witness/record/review`, p);
// 见证任务分配列表
// http://localhost:18089//gdw/witness/record/distribute/list
export const witnessRecordDistributeList = async (p) => await postJson(`${api}/witness/record/distribute/list`, p);
// pdf
// 见证书查看
// https://localhost:18089/gdw/witness/project/book/detail
export const projectBookDetail = async (p) => await postJson(`${api}/witness/project/book/detail`, p);
// 见证书下载
// https://localhost:18089/gdw/witness/project/book/download
export const projectBookDownload = async (p) => await get(`${api}/project/book/download`, p);
// pdf查看下载优化
// 01 获取附件信息
export const attachmentList = async (p) => await get(`${api}/system/attachment/list`, p);
// 查看见证资料-若没有重新生成
// /gdw/witness/record/report
export const witnessRecordReport = async (p) => await get(`${api}/gz/witness/record/report`, p);
// 02 文件下载
export const attachDownload = async (p) => await get(`${api}/platform/attach/download`, p);
// 见证人正在见证的项目列表
// http://localhost:18089/gdw/witness/subtask/list/owner
export const subtaskListOwner = async (p) => await get(`${api}/witness/subtask/list/owner`, p);
// 见证事项规则新增
// https://ip:port/gdw/witness/item-dict/add
export const itemDictAdd = async (p) => await postJson(`${api}/witness/item-dict/add`, p);
// https://ip:port/gdw/witness/item-dict/add
export const itemDictionary = async (p) => await postJson(`${api}/witness/item-rule/listDictionary`, p);
// 见证事项规则查询
// https://ip:port/gdw/witness/item-dict/list
// export const shixiangDictList = async (p) =>
//   await postJson(api + "/witness/item-dict/list", p);
// 见证事项规则查询
// https://ip:port/gdw/witness/item-dict/list
// export const itemDictList = async (p) =>
//   await postJson(api + "/witness/item-dict/list", p);
// 根据条件查询可选见证事项字典
// https://localhost:18089/gdw/witness/item-rule/listDictionary
// export const witnessItemRuleListDictionary = async (p) =>
export const itemDictList = async (p) => await postJson(`${api}/witness/item-rule/listDictionary`, p);
//   见证信息添加
// https://localhost:18089/gdw/witness/info-record/add
export const infoRecordAdd = async (p) => await postJson(`${api}/witness/info-record/add`, p);
// 见证信息查询
// https://localhost:18089/gdw/witness/info-record/list
export const infoRecordList = async (p) => await postJson(`${api}/witness/info-record/list`, p);
// 见证预警查询
// https://localhost:18089/gdw/witness/info-record/list
export const warnRecordList = async (p) => await postJson(`${api}/witness/info-record/warnList`, p);
// 无人值守见证信息查询
// http://localhost:18089/gdw/witness/info-record/querylist
export const infoRecordQuerylist = async (p) => await postJson(`${api}/witness/info-record/querylist`, p);
// 新增无人值守见证信息查询
// http://localhost:18089/g3_witness/gdw/witness/info-record/trade-warn/list
export const newInfoRecordQuerylist = async (p) => await postJson(`${api}/witness/info-record/trade-warn/list`, p);
// 见证分配任务信息查询
// http://localhost:18089/gdw/witness/task-config/list
export const AssignedtasksList = async (p) => await get(`${api}/witness/task-config/list`, p);
// 见证规则信息查询
// http://localhost:18089/gdw/witness/task-config/list
export const ruleList = async (p) => await get(`${api}/witness/rule/list`, p);
// 见证规则信息修改
// http://localhost:18089/gdw/witness/task-config/list
export const rulewitness = async (p) => await postJson(`${api}/witness/rule/update`, p);
// 见证规则任务新增
// http://localhost:18089/gdw/witness/task-config/list
export const addRule = async (p) => await postJson(`${api}/witness/task-config/add`, p);
// 见证规则任务修改
export const ruleUpdate = async (p) => await postJson(`${api}/witness/rule/update`, p);
// 见证规则任务修改
export const updateRule = async (p) => await postJson(`${api}/witness/task-config/update`, p);
// 见证规则删除
export const deleteRule = async (p) => await postJson(`${api}/witness/task-config/delete`, p);
// 见证事项列表查询
export const itemRuleList = async (p) => await postJson(`${api}/witness/item-rule/listPageDictionary`, p);
// 见证事项自定义新增
export const newAddPeople = async (p) => await postJson(`${api}/witness/item-rule/addPeople`, p);
// 见证事项系统新增
export const newAddSystem = async (p) => await postJson(`${api}/witness/item-rule/addSystem`, p);
// 查询见证事项
// https://ip:port/gdw/witness/item-dict/add
export const itemDictionaryAll = async (p) => await postJson(`${api}/witness/item-rule/listDictionaryAll`, p);
// 查询见证事项删除
// https://ip:port/gdw/witness/item-dict/add
export const itemDelete = async (p) => await postJson(`${api}/witness/item-rule/delete`, p);
// 见证事项规则修改
// https://ip:port/gdw/witness/item-dict/add
export const itemDictUpdate = async (p) => await postJson(`${api}/witness/item-rule/update`, p);
// 查看信息记录
// /gdw/witness/project/task/detail
export const projectTaskDetail = async (p) => await get(`${api}/witness/project/task/detail`, p);
// 见证用户管理列表
export const userList = async (p) => await postJson(`${api}/witness/user/list`, p);
// 见证用户管理新增
export const userAdd = async (p) => await postJson(`${api}/witness/user/add`, p);
// 见证用户管理修改
export const userUpdate = async (p) => await postJson(`${api}/witness/user/update`, p);
// 见证用户管理删除
export const userDelete = async (p) => await postJson(`${api}/witness/user/delete`, p);
// 查看见证人员信息
export const userDetail = async (p) => await get(`${api}/witness/user/detail`, p);
// 见证用户状态修改
export const userUpdateStatus = async (p) => await postJson(`${api}/witness/user/updateStatus`, p);
// 在岗日历列表
export const OnCalendar = async (p) => await postJson(`${api}/witness/calendar/leave/list`, p);
// 新增请假
export const newLeave = async (p) => await postJson(`${api}/witness/calendar/leave/add`, p);
// 查看请假
export const checkLeave = async (p) => await get(`${api}/witness/calendar/leave/query`, p);
// 查看视频 /gdw/witness/media/list
// bidSectionCode 标段CODE
// witnessLinkCode 见证环节码
// keyword 检索条件
export const witnessVideoList = async (p) => await get(`${api}/witness/video/list`, p);
// 预警规则
// 预警初始化
export const warnModuleInit = async (p) => await get(`${api}/witness/module/init`, p);
// 预警规则列表查询
export const newWarnList = async (p) => await postJson(`${api}/witness/warning/rule/list`, p);
export const witnessMediaList = async (p) => await get(`${api}/witness/media/list`, p);
export const uploadFile = async (p) => await postFile(`${api}/witness/record/add/attach`, p);
export const getAttachmentList = async (p) => await postJson(`${api}/witness/record/list/attach`, p);
export const deleteAttachment = async (p) => await get(`${api}/witness/record/delete/attach`, p);
// 操作日志列表查询
export const projectList = async (p) => await postJson(`${api}/witness/log/project/list`, p);
// 操作日志列表查询
export const operateList = async (p) => await postJson(`${api}/witness/log/operate/list`, p);
// 根据项目ID和标段CODE查看项目详情（更新后查询）
// /gdw/witness/project/bidSection/detail
// projectId,bidSectionCodeList
export const witnessProjectBidSectionDetail = async (p) =>
  await postJson(`${api}/witness/project/bidSection/detail`, p);
// 系统管理-分配规则管理
// 修改-自动分配规则列表-权重
export const taskConfigUpdateWight = async (p) => await postJson(`${api}/witness/task-config/update/wight`, p);
// 自动分配规则列表-权重
export const witnessTaskConfigListWight = async (p) => await get(`${api}/witness/task-config/list/wight`, p);
// 自动分配规则列表-任务量
export const witnessTaskConfigListNumber = async (p) => await get(`${api}/witness/task-config/list/number`, p);
// 见证任务/下载见证记录
export const subtaskDetailDownload = async (p) => await postJson(`${api}/witness/subtask/detail/download`, p);
// 暂停、恢复和新增见证记录参数一样
export const stopWitness = async (p) => await postJson(`${api}/witness/stop`, p);
export const recoverWitness = async (p) => await postJson(`${api}/witness/recover`, p);
// 暂停记录列表
export const recordStopList = async (p) => await postJson(`${api}/witness/record/stop/list`, p);
export const recordStopUpdate = async (p) => await postJson(`${api}/witness/record/stop/update`, p);
export const recordStopDelete = async (p) => await del(`${api}/witness/record/stop/delete`, p);
export const subtaskTimeDiff = async (p) => await get(`${api}/witness/subtask/timeDiff`, p);
export const subtaskCancelFinished = async (p) => await get(`${api}/witness/subtask/cancelFinished`, p);
// 获取系统时间
export const witnessItemRuleGetTime = async (p) => await get(`${api}/witness/item-rule/getTime`, p);
// 见证子任务见证人员待定确认 /gdw/witness/subtask/pend/confirm?witnessSubTaskId=8a804c1c82cf02520182d39170f200d1
export const witnessSubtaskPendConfirm = async (p) => await get(`${api}/witness/subtask/pend/confirm`, p);
// 探测接口
// system/privilege/init?systemCode=WITNESS_SYSTEM
// 切换系统角色
export const switchIdentity = async (p) => await get(`${api}/platform/common/switchIdentity`, p);
export const jzruserlit = async (p) => await get(`${api}/witness/weeon/buss/allocation/jzrlist`, p);
export const yjzzData = async (p) => await get(`${api}/witness/weeon/buss/allocation/yjzz`, p);
